from rest_framework import serializers
from . import models


class AdminRecordSerializer(serializers.ModelSerializer):
    group_name = serializers.SerializerMethodField()

    def get_group_name(self, obj):
        return obj.get_group_display()

    class Meta:
        model = models.AdminRecord
        fields = ['id', 'group_name', 'detail', 'date_add', 'admin']
        read_only_fields = ['id', 'group_name', 'detail', 'date_add', 'admin']
